#include <iostream>
#include <list>
using namespace std;

void show_list(list<int> L)
{ list<int>::iterator p;
  for(p=L.begin(); p!=L.end(); p++)
    cout << *p << " ";
  cout << endl;
}    

int main()
{ int a[4]={12,15,65,73};
  list<int> L1(a,a+4); 
  int b[5]={17,19,25,70,80};
  list<int> L2(b,b+5); 
   
  show_list(L1);
  show_list(L2);
  
  list<int> R;
  
  list<int>::iterator p=L1.begin();
  list<int>::iterator q=L2.begin();
  
  while(p!=L1.end() && q!=L2.end())
  { if(*p <= *q)
    { R.push_back(*p); p++; }
    else
    { R.push_back(*q); q++; }
  }   
    
  while(p!=L1.end())
  { R.push_back(*p); p++; }
    
  while(q!=L2.end())
  { R.push_back(*q); q++;  }
    
      
  show_list(R);  
    
  
  return 0;
}    
